package com.crl.module.cmpRpc.section
{
	import com.crl.core.config.section.handler.IConfigSectionHandler;
	import com.crl.module.cmpRpc.model.RequestVO;
	
	import flash.utils.Dictionary;
	
	
	/**
	 * 自定义解析节点,解释器; 
	 * @author Administrator
	 * 
	 */	
	public class RPCSectionHandler implements IConfigSectionHandler
	{
		private var requests:Dictionary;
		private var inited:Boolean=false;
		public function RPCSectionHandler()
		{
			requests=new Dictionary(true);
		}
		
		public function create(sectionNode:XML):Object
		{
			if(inited==false){
				inited=true;
				
				var list:XMLList=sectionNode.descendants("request");
				if(list.length()==0){
					return null;
				}
				
				var vo:RequestVO=new RequestVO();
				for each(var item:XML in list){
					vo.bindXML(item);
					
					requests[vo.method]=vo;
				}
			}
			
			return requests;
		}
	}
}